package net.acoinWork.dynRender.render;

import net.acoinWork.dynRender.configParse.propertyModel.Common;
import org.apache.velocity.VelocityContext;

import java.util.Map;

/**
 * @author xusk
 * @date: 16/1/2 下午5:45
 */
public enum RendererEngineEnum {
    VELOCITY {
        @SuppressWarnings("unchecked")
        @Override
        public Renderer<VelocityContext> getEngineRenderer() {
            return VelocityRenderer.INSTANCE;
        }

        @Override
        public String getLibPath(Common common) {
            return common.getVelocity().getLibPath();
        }
    }, FREEMARKER {
        @SuppressWarnings("unchecked")
        @Override
        public Renderer<Map> getEngineRenderer() {
            return FreeMarkerRenderer.INSTANCE;
        }

        @Override
        public String getLibPath(Common common) {
            return common.getFreemarker().getLibPath();
        }
    };
    public abstract <E> Renderer<E>  getEngineRenderer();

    public abstract String getLibPath(Common common);
}
